package com.isoftstone.project.system.service.impl;


import com.isoftstone.framework.domain.Page;
import com.isoftstone.project.system.domain.SysRole;
import com.isoftstone.project.system.mapper.SysRoleMapper;
import com.isoftstone.project.system.service.ISysRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


@Service
public class SysRoleService implements ISysRoleService {

    @Autowired
    SysRoleMapper sysRoleMapper;


    public SysRole getRoleById(String roleId) throws Exception {
        return sysRoleMapper.getRoleById(roleId);
    }

    public SysRole getRoleByCode(String roleCode) throws Exception {
        return sysRoleMapper.getRoleByCode(roleCode);
    }

    @Override
    public SysRole getRoleByCodeName(String roleName) throws Exception {
        return sysRoleMapper.getRoleByCodeName(roleName);
    }

    public List<SysRole> getRolelistPage(Page page) throws Exception {
        return sysRoleMapper.getRolelistPage(page);
    }

    @Transactional
    public void saveRole(SysRole role) throws Exception {
        sysRoleMapper.saveRole(role);
    }

    @Transactional
    public void updateRole(SysRole role) throws Exception {
        sysRoleMapper.updateRole(role);
    }

    @Transactional
    public void deleteRole(String roleId) throws Exception {
        sysRoleMapper.deleteRole(roleId);
    }

	public List<SysRole> getRole(String userId) throws Exception {
		return sysRoleMapper.getRole(userId);
	}
}
